﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>流程审批</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <link href="/CSS/bootstrap3.3.5/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="/CSS/Base/BaseClass.css?cssver=4" rel="stylesheet" type="text/css" />
    <link href="/JqueryPlug/dtGrid/jquery.dtGrid.css" rel="stylesheet">
    <link href="/CSS/font-awesome-4.3.0/css/font-awesome.min.css" rel="stylesheet">
    <script src="/Scripts/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" src="/JqueryPlug/layer/layer/layer.js"></script>
    <script src="/Scripts/avalon.min.js"></script>
    <script src="/Scripts/SZHLCommon.js?jsver=5"></script>
    <script src="/JqueryPlug/dtGrid/jquery.dtGrid.js"></script>
    <script>

        var grid, dtoption, viewindex;

        //获取主要菜单
        dtoption = {
            lang: 'zh-cn',
            check: false,
            ajaxLoad: false,
            exportFileName: '审批列表',
            columns: [
                { id: 'ID', title: '序号', type: 'string', columnClass: 'text-center', hide: true },
                { id: 'ShenQingRen', title: '创建人', type: 'string', columnClass: 'text-center' },
                { id: 'Name', title: '流程名称', type: 'string', columnClass: 'text-center' },
                { id: 'CRDate', title: '创建时间', type: 'string', columnClass: 'text-center' },
                {
                    id: 'Option', title: '审批状态', type: 'string', columnClass: 'text-center', resolution: function (value, record, column, grid, dataNo, columnNo) {
                        if (status == "正在审批") {
                            content = "<a  href='javascript:void(0)' onclick='ViewWF(" + record.ID + "," + record.intProcessStanceid + ",\"" + record.ProName + "\")'><i class='iconfont icon-shezhichilun fa-spin'></i>" + record.StateName + "</a>";
                        } else if (status == "已退回") {
                            content = "<a href='javascript:void(0)' style='color:red' onclick='ViewWF(" + record.ID + "," + record.intProcessStanceid + ",\"" + record.ProName + "\")'>" + record.StateName + "</a>";
                        } else {
                            content = "<a href='javascript:void(0)'  style='color:green' onclick='ViewWF(" + record.ID + "," + record.intProcessStanceid + ",\"" + record.ProName + "\")'>" + record.StateName + "</a>";
                        }
                        return content;
                    }
                }],
            gridContainer: 'dtgrid',
            toolbarContainer: 'dtgridTool',
            pageSize: 10,
            pageSizeLimit: [10, 20, 50],
            tools: 'faseQuery',
            onGridComplete: function (grid) {
                var log = '<p>表格加载完成。表格编号：' + grid.option.id + '。</p>';
            }
        };
        function ViewWF(ID, PIID, ProName) {
            parent.ComFunJS.winviewform("/View/APPBaseView/APP_ADD_WF.html?FormCode=" + ProName + "&ID=" + ID + "&PIID=" + PIID, "审核表单", "1000", "");
        }
        var model = avalon.define({
            $id: "APP_WF_Status",
            menutype: "",//菜单类型(0:个人日报.-1:"当前部门日报")
            selmenu: function (val) {
                model.menutype = val;
                model.CommonData.clear();
                model.GetSPDataList()
            },//选中菜单事件
            addLCSP: function () {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_LCSP_SEL.html", "", "1000", "");
            },
            curSPType: "",
            SPTypeData: [],
            CommonData: [],
            SearchContent: "",
            DSPCount: "",
            YSPCOunt: "",
            GetSPDataList: function () {
                model.CommonData.clear();
                var actionName = "";
                if (model.menutype) {
                    actionName = "GETYSPLIST";
                } else { 
                    actionName = "GETDSHDATA";
                }
                $.getJSON('/API/FTAPI.ashx?Action=' + actionName, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        model.CommonData = resultData.Result;
                        if (dtoption.datas != undefined) {
                            dtoption.originalDatas = model.CommonData;

                        } else {
                            dtoption.datas = model.CommonData;
                            grid = $.fn.DtGrid.init(dtoption);
                        }
                        grid.load()
                    }
                })

            }
        });
        avalon.ready(function () {
            $.getJSON('/API/FTAPI.ashx?Action=GETWFMENUCOUNT', function (resultData) {
                if (resultData.ErrorMsg == "") {
                    model.DSPCount = resultData.Result == "0" ? "" : resultData.Result;
                    model.YSPCOunt = resultData.Result1 == "0" ? "" : resultData.Result1;
                }
            })
            model.GetSPDataList();
           
        })
       
    </script>
</head>
<body ms-controller="APP_WF_Status">
    <div class="container-fluid maindiv" style="margin-top: 20px" id="dvContent">
        <div style="width:120px;position:absolute">
            <ul class="list-group text-center  leftmenu ">
                <li class="list-group-item sel" ms-class-1="sel:menutype==''" ms-click="selmenu('')">
                    <div>
                        <i class="iconfont icon-iconfontqingjiaguanli hvr-grow"></i>
                        {{DSPCount}}
                    </div>
                    <div>待审批</div>
                </li>
                <li class="list-group-item sel" ms-class-1="sel:menutype=='-1'" ms-click="selmenu('-1')">
                    <div>
                        <i class="iconfont icon-iconfontqingjiaguanli hvr-grow"></i>
                        {{YSPCOunt}}
                    </div>
                    <div>已审批</div>
                </li>
            </ul>
        </div>
        <div class="row contentdv" style="margin-left:121px">
            <div class="col-xs-12 ">
                <div id="dtgrid" style="margin-top:20px"></div>
                <div id="dtgridTool" class="dt-grid-toolbar-container"></div>
            </div>
        </div>
    </div>
</body>
</html>
